<?php

namespace app\logic\model\music;

use app\logic\model\LogicModel;
use think\model\concern\SoftDelete;

class MusicTypeLogicModel extends LogicModel
{

    use SoftDelete;

    protected $name='music_type';

    protected $deleteTime = 'delete_time';

    public function getList(\think\Request $request, array $where, string $field='*', $page = 1, $limit=15,$order='sort desc,id desc')
    {
        $query=$this->where($where)
            ->where(function ($q) use ($request){
                if(check_request($request,'title')){
                    $q->whereLike("title","%{$request['title']}%");
                }
            });
        $list = $query->field($field)->order($order)->page($page,$limit)->select();
        $count = $query->count();
        return [$list,$count];
    }
}